
<div class="container">
      <div class="row">
        <div class="col-md-12" style="width:  auto;padding-left: 15px;">
          <div class="panel panel-visible">
            <div class="panel-heading">
              <div class="panel-title hidden-xs"> <span class="glyphicon glyphicon-tasks"></span> Báo cáo</div>            
            </div>
            <div class="panel-body padding-bottom-none">
                <div class="panel-export">
                    <label style="float:  left;width: 7%">Chọn nhân viên</label>
                    <div style="float:  left;width: auto;margin-right: 10px">
                        <select style="padding: 3px" id="change-crew">
                            <?php echo $listcrew;?>
                        </select>
                    </div>
                    <div style="float:  left;width: 130px;font-size: 18px;">Chọn thời gian</div>
                    <div id="reportrange" class="pull-right">
                          <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
                          <span></span> <b class="caret"></b>
                          <input type="hidden" id="times" value="" />
                    </div> 
                    <button id="show-report">Xem báo cáo</button>
                    <button onclick="exportToExcel()">Xuất báo cáo</button>
                    
                </div>
              <table class="table table-striped table-bordered table-hover" id="Categrories">
                <thead>
                  <tr>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>ISM/ISO No. VLC-15-02</th>
                  </tr>
                  
                  <tr style="background: #FFF;color: #333">
                    <th colspan="52" style="color: #333;">RECORD OF HOURS OF REST OF SEAFARERS</th>
                    <th>Date: <?php echo date('d/m/Y')?></th>
                  </tr>
                  
                  <tr style="background: #FFF;color: #333">
                    <th colspan="52">Bản ghi số giờ nghỉ ngơi của thuyền viên</th>
                    <th>Revision: 11</th>
                  </tr>
                  
                  <tr style="background: #FFF;color: #333">
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>Page: __ of __</th>
                  </tr>
                  
                  <tr style="background: #FFF;color: #333">
                    <th colspan="15" style="text-align: left;">Name of ship (Tên tàu):</th>
                  
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th colspan="9" style="text-align: left;">IMO Number (Số IMO):</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th colspan="2" style="text-align: left;">Flag of ship (Cờ quốc tịch của tàu):</th>
                  </tr>
                  
                  <tr style="background: #FFF;color: #333">
                    <th colspan="15" style="text-align: left;">Full Name ( Họ và tên ): <?php echo $info->fullname?></th>
                    
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    
                    <th colspan="9" style="width: 150px;">Month and year ( Tháng và Năm ):</th>
                    
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th colspan="2">Watchkeeper ( Người trực ca ): Yes(Có)/ No(Không)</th>
                  </tr>
                  
                  <tr style="background: #FFF;color: #333">
                    <th colspan="15" style="text-align: left;">Rank (Chức danh): <?php echo $info->rank?></th>
                    
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                  </tr>
                  
                  <tr style="background: ##333;color: #333">
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;</th>
                  </tr>
                </thead>
                <tbody>
                
                <tr>
                    <td colspan="51">Please mark period of rest with an "X", or using a continuos line (Sử dụng dấu "X" hoặc đường kẻ liền để đánh dấu giai đoạn nghỉ ngơi)</td>
                    <td colspan="2" style="text-align: center;">For addtional calculation or verification (If necessary) Dùng để tính toán hoặc kiểm tra bổ sung (Nếu cần thiết)</td>
                </tr>
                
                
                <tr style="text-align: center;">
                    <td>Hours <br/> (Giờ)</td>
                    <td colspan="2">1</td>
                    <td colspan="2">2</td>
                    <td colspan="2">3</td>
                    <td colspan="2">4</td>
                    <td colspan="2">5</td>
                    <td colspan="2">6</td>
                    <td colspan="2">7</td>
                    <td colspan="2">8</td>
                    <td colspan="2">9</td>
                    <td colspan="2">10</td>
                    <td colspan="2">11</td>
                    <td colspan="2">12</td>
                    <td colspan="2">13</td>
                    <td colspan="2">14</td>
                    <td colspan="2">15</td>
                    <td colspan="2">16</td>
                    <td colspan="2">17</td>
                    <td colspan="2">18</td>
                    <td colspan="2">19</td>
                    <td colspan="2">20</td>
                    <td colspan="2">21</td>
                    <td colspan="2">22</td>
                    <td colspan="2">23</td>
                    <td colspan="2">24</td>
                    <td rowspan="2">Hours of rest in 24 hour period-(Số giờ nghỉ ngơi trong khoảng thời gian 24 giờ)</td>
                    <td rowspan="2">Comments<br />(Ghi chú)</td>
                    <td rowspan="2">Hours of rest in any 24 hour period (Số giờ nghỉ ngơi trong giai đoạn 24 giờ bất kỳ)</td>
                    <td rowspan="2">Hours of rest in any 7 day period (Số giờ nghỉ ngơi trong giai đoạn 7 ngày bất kỳ)</td>
                </tr>
                
                <tr>
                    <td style="text-align: center;">Date (Ngày)</td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                    <td colspan="2"><span class="rotate">&nbsp;</span></td>
                </tr>
                
                    <?php echo $dataReport; ?>
                    
                <tr>
                    <td colspan="53" style="text-align: left;">I agree that this record is an accurate reflection of the hours of rest of the seafarer concerned (Tôi đồng ý rằng bản ghi số giờ nghỉ ngơi của thuyền viên trên là chính xác)</td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td colspan="15" style="text-align: center;">Signature of seafarer</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td colspan="14" style="text-align: center;">Signature of Chief Officer/ Chief Engineer</td>
                    <td colspan="2" style="text-align: center;">Signature of Master</td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td colspan="15" style="text-align: center;">(Chữ ký của thuyền viên)</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td colspan="14" style="text-align: center;">(Chữ ký của Đại phó/Máy trưởng)</td>
                    <td colspan="2" style="text-align: center;">(Chữ ký của Thuyền trưởng)</td>
                </tr>
                <tr>
                    <td colspan="53"> &nbsp;</td>
                </tr>
                <tr>
                    <td colspan="53"> &nbsp;</td>
                </tr>
                <tr>
                    <td colspan="53"> &nbsp;</td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td colspan="52" style="font-weight: bold;"> 1. Số giờ nghỉ ngơi tối thiểu không được ít hơn: (a) 10 giờ trong khoảng thời gian 24 giờ bất kỳ; 77 giờ trong khoảng thời gian 07 ngày bất kỳ (b).</td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td colspan="52" style="font-weight: bold;"> 2. Số giờ nghỉ ngơi trong 24 giờ liên tục được chia tối đa thành 02 đợt, một đợt ít nhất 6 giờ, và thời gian giữa các đợt nghỉ liên tiếp không quá 14 giờ.</td>
                </tr>    
                <tr>
                    <td>&nbsp;</td>
                    <td colspan="52" style="font-weight: bold;"> 3. Khoảng thời gian 24 giờ bất kỳ được tính từ thời điểm bắt đầu hoặc kết thúc của một giai đoạn nghỉ ngơi.</td>
                </tr>
                    
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
</div>

<link href="<?php echo $baseurl.'public/theme/default/picker/'?>font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="all" href="<?php echo $baseurl.'public/theme/default/picker/'?>daterangepicker-bs3.css" />
<script type="text/javascript" src="<?php echo $baseurl.'public/theme/default/picker/'?>moment.js"></script>
<script type="text/javascript" src="<?php echo $baseurl.'public/theme/default/picker/'?>daterangepicker.js"></script>
<script type="text/javascript">
$(document).ready(function() {

  var cb = function(start, end, label) {
    //console.log(start.toISOString(), end.toISOString(), label);
    $('#reportrange span').html(start.format('DD/MM/YYYY HH:mm:ss') + ' - ' + end.format('DD/MM/YYYY HH:mm:ss'));
    $("#times").val(start.format('DD/MM/YYYY HH:mm:ss') + ' - ' + end.format('DD/MM/YYYY HH:mm:ss'));
  }

  var optionSet1 = {
    startDate: moment().subtract('days', 0),
    endDate: moment(),
    minDate: '01/01/2014',
    maxDate: '12/31/2030',
    dateLimit: { days: 60 },
    showDropdowns: true,
    showWeekNumbers: true,
    timePicker: true,
    timePickerIncrement: 1,
    timePicker12Hour: true,
    ranges: {
       'Today': [moment().startOf('day'), moment()],
       'Yesterday': [moment().subtract('days', 1).startOf('day'), moment().subtract('days', 1).endOf('day')],
       'Last 7 Days': [moment().subtract('days', 6).startOf('day'), moment().endOf('day')],
       'Last 30 Days': [moment().subtract('days', 29).startOf('day'), moment().endOf('day')],
       'This Month': [moment().startOf('month').startOf('day'), moment().endOf('month')],
       'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
    },
    opens: 'left',
    buttonClasses: ['btn btn-default'],
    applyClass: 'btn-small btn-primary',
    cancelClass: 'btn-small',
    format: 'DD/MM/YYYY HH:mm',
	timePicker: true,
    separator: ' to ',
    locale: {
        applyLabel: 'Đồng ý',
        cancelLabel: 'Clear',
        fromLabel: 'From',
        toLabel: 'To',
        customRangeLabel: 'Custom',
        daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr','Sa'],
        monthNames: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
        firstDay: 1
    }
  };

  var optionSet2 = {
    startDate: moment().subtract('days', 7),
    endDate: moment(),
    opens: 'left',
    ranges: {
       'Today': [moment(), moment()],
       'Yesterday': [moment().subtract('days', 1), moment().subtract('days', 1)],
       'Last 7 Days': [moment().subtract('days', 6), moment()],
       'Last 30 Days': [moment().subtract('days', 29), moment()],
       'This Month': [moment().startOf('month'), moment().endOf('month')],
       'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
    }
  };

  $('#reportrange span').html(<?php echo $times ? "'".$times."'" : "moment().subtract(29, 'days').format('DD/MM/YYYY HH:mm:00') + ' - ' + moment().format('DD/MM/YYYY HH:mm:00')"?>);//alert('sdf');
  $('#times').val(<?php echo $times ? "'".$times."'" : "moment().subtract(29, 'days').format('DD/MM/YYYY HH:mm:00') + ' - ' + moment().format('DD/MM/YYYY HH:mm:00')"?>);

  $('#reportrange').daterangepicker(optionSet1, cb);

  $('#reportrange').on('show.daterangepicker', function() { console.log("show event fired"); });
  $('#reportrange').on('hide.daterangepicker', function() { console.log("hide event fired"); });
  $('#reportrange').on('apply.daterangepicker', function(ev, picker) { 
    console.log("apply event fired, start/end dates are " 
      + picker.startDate.format('DD/MM/YYYY HH:mm:00') 
      + " to " 
      + picker.endDate.format('DD/MM/YYYY HH:mm:00')
    ); 
  });
  $('#reportrange').on('cancel.daterangepicker', function(ev, picker) { console.log("cancel event fired"); });

  $('#options1').click(function() {
    $('#reportrange').data('daterangepicker').setOptions(optionSet1, cb);
  });

  $('#options2').click(function() {
    $('#reportrange').data('daterangepicker').setOptions(optionSet2, cb);
  });

  $('#destroy').click(function() {
    $('#reportrange').data('daterangepicker').remove();
  });

});

$(document).ready(function()
{
    $('#show-report').click(function()
    {
        var staff = $('#change-crew').val();
        if(staff == '')
        {
            alert('Vui lòng chọn 1 nhân viên');
            return false;
        }
        var times = $('#times').val();
        window.location = '<?php echo site_url()?>report?id='+staff+'&times='+times;
    })
});

function exportToExcel()
{
    var data='<table border="1">'+$("#Categrories").html().replace(/<a\/?[^>]+>/gi, '')+'</table>';
    $('body').prepend("<form method='post' action="+'<?php echo site_url()?>/exportexcel.php'+" style='display:none' id='Categroriess'><input type='text' name='tableData' value='"+data+"' ></form>");
    $(".orverlay").css('display', 'block');
    $('#Categroriess').submit(function(e)
    {
    });
    $('#Categroriess').submit().remove();
    return false;
}

</script>